(require 'hilit-chg)


;; To get things really working, some hooks needs to be set up.


;; Remove highlighted changes by every save-buffer.
(add-hook 'after-save-hook
          (lambda()
            (highlight-changes-remove-highlight (point-min) (point-max))))

;; Turn highlight-changes-mode off, when buffer gets reverted. file might be
;; read-only. Then no highlighting can be removed.
(add-hook 'before-revert-hook
          (lambda ()
            (when (not buffer-read-only)
              (highlight-changes-mode -1))))

;; Turn highlight-changes-mode on, when it is a non-special buffer with file
;; status read/write.
(add-hook 'first-change-hook
          (lambda ()
            (when (not (eq buffer-file-name nil))
              (when (not buffer-read-only)
                (highlight-changes-mode 1)))))


(setq highlight-changes-visibility-initial-state t)
(global-highlight-changes-mode 1)

(provide 'resource/hilit-chg)
